#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) Huoty, All rights reserved
# Author: Huoty <sudohuoty@163.com>
# CreateTime: 2024-12-03 11:12:54

import sys


def __getattr__(name):
    if name.startswith('_x'):
        raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
    return f"hello {name}"


def access_attribute(name):
    # 使用 getattr 来访问模块级别的属性
    return getattr(sys.modules[__name__], name)


# 在同一模块中模拟属性访问
print(access_attribute('baby'))  # 这将触发 __getattr__

